

#if defined(__USE_LT8619_RX__)


#ifndef		__EDID_TABLE_H__
#define		__EDID_TABLE_H__

/*
 * Macros to construct EDID table
 */
#define mfgname2id(v1,v2,v3) (((((v1)-'@')&0x1F)<<10)|((((v2)-'@')&0x1F)<<5)|(((v3)-'@')&0x1F))
#define swap16(v1) (((v1)>>8)|(((v1)&0xFF)<<8))
#define word2bytes(w) (w)&0xFF,((w)>>8)&0xFF
#define dword2bytes(w) (w)&0xFF,((w)>>8)&0xFF,((w)>>16)&0xFF,((w)>>24)&0xFF
#define cc2bits10(c) (unsigned)((c)*1024+0.5)
#define cc_lsbs4(v1,v2,v3,v4) (((v1&0x03)<<6)|((v2&0x03)<<4)|((v3&0x03)<<2)|(v4&0x03))
#define lsbs2(v1,v2) ((((v1)&0x0F)<<4)|((v2)&0x0F))
#define msbs2(v1,v2) ((((v1)>>4)&0xF0)|(((v2)>>8)&0x0F))
#define combine_2x12bits(a,b) (a)&0xff,(b)&0xff,msbs2(a,b)
#define dtd_msbs4(v1,v2,v3,v4) ((((v1)>>2)&0xc0)+(((v2)>>4)&0x30)+(((v3)>>2)&0x0C)+(((v4)>>4)&0x03))
#define dtd_offset_pulse(xo,xp,yo,yp) (xo)&0xff,(xp)&0xff,lsbs2(yo,yp),dtd_msbs4(xo,xp,yo,yp)

/* Detailed Timing Descriptor
  (+00H~01H) Pixel clock in 10 kHz units. (0.-655.35 MHz, little-endian)
  (+02H) Horizontal active pixels 8 LSbits (0-4095)
  (+03H) Horizontal blanking pixels 8 LSbits (0-4095)
  (+04H) [7:4] Horizontal active pixels 4 MSbits
         [3:0]	Horizontal blanking pixels 4 MSbits
  (+05H) Vertical active lines 8 LSbits (0-4095)
  (+06H) Vertical blanking lines 8 LSbits (0-4095)
  (+07H) [7:4]	Vertical active lines 4 MSbits
         [3:0]	Vertical blanking lines 4 MSbits
  (+08H) Horizontal front porch pixels 8 lsbits (0-1023)
  (+09H) Horizontal sync pulse width pixels 8 lsbits (0-1023)
  (+0AH) [7:4] Vertical front porch lines 4 lsbits (0-63)
         [3:0] Vertical sync pulse width lines 4 lsbits (0-63)
  (+0BH) [7:6]	Horizontal front porch pixels 2 msbits
         [5:4] Horizontal sync pulse width pixels 2 msbits
         [3:2] Vertical front porch lines 2 msbits
         [1:0] Vertical sync pulse width lines 2 msbits
  (+0CH) Horizontal display size, mm, 8 lsbits (0-4095 mm, 161 in)
  (+0DH) Vertical display size, mm, 8 lsbits (0-4095 mm, 161 in)
  (+0EH) [7:4] Horizontal display size, mm, 4 msbits
         [3:0] Vertical display size, mm, 4 msbits
  (+0FH~10H) Horizontal & Vertical border pixels (each side; total is twice this)
  (+11H) [7] Interlaced
         [6:5,0] Stereo mode: 00x=no stereo
         [4] Sync type: 1=digital sync
         [3] 1=separate sync
         [2] Vertical sync polarity: 1=positive
         [1] Horizontal sync polarity: 1=positive
*/
#define DTD(clk,ha,hb,hf,hp,hsp,va,vb,vf,vp,vsp,i,hsz,vsz) \
	word2bytes((clk)/10), \
	combine_2x12bits(ha,hb), \
	combine_2x12bits(va,vb), \
	dtd_offset_pulse(hf,hp,vf,vp), \
	combine_2x12bits(hsz,vsz), \
	0x00, 0x00, \
	(i<<7)|0x18|(vsp<<2)|(hsp<<1)

#define POL_NEG	0	//negative polarity
#define POL_POS	1	//positive polarity
#define ST_PROG	0	//progressive
#define ST_INTR	1	//interlaced

#define VID_HSIZE	886	//[mm]
#define VID_VSIZE	498	//[mm]

//DTD(clock[kHz],Hactive,Hblank,Hfporch,Hpulse,Hsync_pol,
//	Vactive,Vblank,Vfporch,Vpulse,Vsync_pol,
//	sig_type,Hsize[mm],Vsize[mm])
// where sync_pol = neg(0),pos(1)
//       sig_type = progressive(0),interlaced(1)
#define DTD_640X480P60	DTD(25170, 640,160,16,96,POL_NEG, 480,45,10,2,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=1
#define DTD_720X480P60	DTD(27000, 720,141,19,62,POL_NEG, 480,45,9,6,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=2
#define DTD_1280X720P60	DTD(74250, 1280,370,110,40,POL_POS, 720,30,5,5,POL_POS, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=4
#define DTD_1920X1080I60	DTD(74250, 1920,280,88,44,POL_POS, 1080,22,2,5,POL_POS, ST_INTR,VID_HSIZE,VID_VSIZE)	//VIC=5
#define DTD_720X480I60	DTD(27000, 720,193,17,62,POL_NEG, 480,23,5,3,POL_NEG, ST_INTR,VID_HSIZE,VID_VSIZE)	//VIC=6
#define DTD_1440X240P60	DTD(27000, 1440,276,38,124,POL_NEG, 240,22,4,3,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=8
#define DTD_1440X240P60	DTD(27000, 1440,276,38,124,POL_NEG, 240,22,4,3,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=8
#define DTD_2880X480I60	DTD(54000, 2880,552,76,248,POL_NEG, 480,22,4,3,POL_NEG, ST_INTR,VID_HSIZE,VID_VSIZE)	//VIC=10
#define DTD_2880X240P60	DTD(54000, 2880,552,76,248,POL_NEG, 240,22,4,3,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=12
#define DTD_2880X240P60	DTD(54000, 2880,552,76,248,POL_NEG, 240,22,4,3,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=12
#define DTD_1440X480P60	DTD(54000, 1440,276,32,124,POL_NEG, 480,45,9,6,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=14
#define DTD_1920X1080P60	DTD(148500, 1920,280,88,44,POL_POS, 1080,45,4,5,POL_POS, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=16
#define DTD_720X576P50	DTD(27000, 720,144,12,64,POL_NEG, 576,49,5,5,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=17
#define DTD_1280X720P50	DTD(74250, 1280,700,440,40,POL_POS, 720,30,5,5,POL_POS, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=19
#define DTD_1920X1080I50	DTD(74250, 1920,720,528,44,POL_POS, 1080,22,2,5,POL_POS, ST_INTR,VID_HSIZE,VID_VSIZE)	//VIC=20
#define DTD_720X576I50	DTD(27000, 720,225,24,63,POL_NEG, 576,24,2,3,POL_NEG, ST_INTR,VID_HSIZE,VID_VSIZE)	//VIC=21
#define DTD_1440X288P50	DTD(27000, 1440,288,24,126,POL_NEG, 288,24,2,3,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=23
#define DTD_1440X288P50	DTD(27000, 1440,288,24,126,POL_NEG, 288,24,2,3,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=23
#define DTD_1440X288P50	DTD(27000, 1440,288,24,126,POL_NEG, 288,24,2,3,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=23
#define DTD_2880X576I50	DTD(54000, 2880,576,48,252,POL_NEG, 576,24,2,3,POL_NEG, ST_INTR,VID_HSIZE,VID_VSIZE)	//VIC=25
#define DTD_2880X288P50_312TOTAL	DTD(54000, 2880,576,48,252,POL_NEG, 288,24,2,3,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=27
#define DTD_2880X288P50_313TOTAL	DTD(54000, 2880,576,48,252,POL_NEG, 288,25,3,3,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=27
#define DTD_2880X288P50_314TOTAL	DTD(54000, 2880,576,48,252,POL_NEG, 288,26,4,3,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=27
#define DTD_1440X576P50	DTD(54000, 1440,288,24,128,POL_NEG, 576,49,5,5,POL_POS, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=29
#define DTD_1920X1080P50	DTD(148500, 1920,720,528,44,POL_POS, 1080,45,4,5,POL_POS, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=31
#define DTD_1920X1080P24	DTD(74250, 1920,830,638,44,POL_POS, 1080,45,4,5,POL_POS, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=32
#define DTD_1920X1080P25	DTD(74250, 1920,720,528,44,POL_POS, 1080,45,4,5,POL_POS, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=33
#define DTD_1920X1080P30	DTD(74250, 1920,720,528,44,POL_POS, 1080,45,4,5,POL_POS, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=34
#define DTD_2880X480P59	DTD(108000, 2880,552,64,248,POL_NEG, 480,45,9,6,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=35
#define DTD_2880X576P50	DTD(108000, 2880,576,48,256,POL_NEG, 576,49,5,5,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=37
#define DTD_1920X1080I50_1250TOTAL	DTD(72000, 1920,384,32,168,POL_NEG, 1080,116,24,5,POL_NEG, ST_INTR,VID_HSIZE,VID_VSIZE)	//VIC=39
#define DTD_1920X1080I100	DTD(148500, 1920,720,528,44,POL_POS, 1080,22,2,5,POL_POS, ST_INTR,VID_HSIZE,VID_VSIZE)	//VIC=40
#define DTD_1280X720I100	DTD(148500, 1280,660,400,40,POL_POS, 720,30,5,5,POL_POS, ST_INTR,VID_HSIZE,VID_VSIZE)	//VIC=41
#define DTD_720X576P100	DTD(54000, 720,144,12,64,POL_NEG, 576,49,5,5,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=42
#define DTD_720X576I100	DTD(54000, 720,144,12,63,POL_NEG, 576,24,2,3,POL_NEG, ST_INTR,VID_HSIZE,VID_VSIZE)	//VIC=44
#define DTD_1920X1080I119	DTD(148500, 1920,281,88,44,POL_POS, 1080,22,2,5,POL_POS, ST_INTR,VID_HSIZE,VID_VSIZE)	//VIC=46
#define DTD_1280X720P119	DTD(148500, 1280,370,110,40,POL_POS, 720,30,5,5,POL_POS, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=47
#define DTD_720X480P119	DTD(54000, 720,138,16,62,POL_NEG, 480,46,10,6,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=48
#define DTD_720X480I119	DTD(54000, 720,138,19,62,POL_NEG, 480,22,4,3,POL_NEG, ST_INTR,VID_HSIZE,VID_VSIZE)	//VIC=50
#define DTD_720X576P200	DTD(108000, 720,144,12,64,POL_NEG, 576,49,5,5,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=52
#define DTD_720X576I200	DTD(108000, 720,144,12,63,POL_NEG, 576,24,2,3,POL_NEG, ST_INTR,VID_HSIZE,VID_VSIZE)	//VIC=54
#define DTD_720X480P240	DTD(108000, 720,138,16,62,POL_NEG, 480,45,9,6,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=56
#define DTD_720X480I240	DTD(108000, 720,138,19,62,POL_NEG, 480,22,4,3,POL_NEG, ST_INTR,VID_HSIZE,VID_VSIZE)	//VIC=58
#define DTD_3840X2160P24	DTD(297000, 3840,1660,1276,88,POL_POS, 2160,90,8,10,POL_POS, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=93
#define DTD_3840X2160P25	DTD(297000, 3840,1440,1056,88,POL_POS, 2160,90,8,10,POL_POS, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=94
#define DTD_3840X2160P30	DTD(297000, 3840,560,176,88,POL_POS, 2160,90,8,10,POL_POS, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=95
#define DTD_3840X2160P50	DTD(594000, 3840,1440,1056,88,POL_POS, 2160,90,8,10,POL_POS, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=96
#define DTD_3840X2160P60	DTD(594000, 3840,560,176,88,POL_POS, 2160,90,8,10,POL_POS, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=97
#define DTD_4096X2160P24	DTD(297000, 4096,1404,1020,88,POL_NEG, 2160,90,8,10,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=98
#define DTD_4096X2160P25	DTD(297000, 4096,1184,968,88,POL_NEG, 2160,90,8,10,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=99
#define DTD_4096X2160P30	DTD(297000, 4096,304,88,88,POL_NEG, 2160,90,8,10,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=100
#define DTD_4096X2160P50	DTD(594000, 4096,1184,968,88,POL_NEG, 2160,90,8,10,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=101
#define DTD_4096X2160P60	DTD(594000, 4096,304,88,88,POL_NEG, 2160,90,8,10,POL_NEG, ST_PROG,VID_HSIZE,VID_VSIZE)	//VIC=102



//CEA-861 Data Block Tag code
#define CEA_TAG_AUDIO	1
#define CEA_TAG_VIDEO	2
#define CEA_TAG_VSDB	3
#define CEA_TAG_SPEAKER	4
#define CEA_TAG_VESA	5

//CEA-861 VIC code
#define CEA_VID_640X480P60	1
#define CEA_VID_720X480P60_4X3	2
#define CEA_VID_720X480P60_16X9	3
#define CEA_VID_1280X720P60	4
#define CEA_VID_1920X1080I60	5
#define CEA_VID_720X480I60_4X3	6
#define CEA_VID_720X480I60_16X9	7
#define CEA_VID_720X240P60_4X3	8
#define CEA_VID_720X240P60_16X9	9
#define CEA_VID_2880X480I60_4X3	10
#define CEA_VID_2880X480I60_16X9	11
#define CEA_VID_2880X240P60_4X3	12
#define CEA_VID_2880X240P60_16X9	13
#define CEA_VID_1440X480P60_4X3	14
#define CEA_VID_1440X480P60_16X9	15
#define CEA_VID_1920X1080P60	16
#define CEA_VID_720X576P50_4X3	17
#define CEA_VID_720X576P50_16X9	18
#define CEA_VID_1280X720P50	19
#define CEA_VID_1920X1080I50	20
#define CEA_VID_720X576I50_4X3	21
#define CEA_VID_720X576I50_16X9	22
#define CEA_VID_720X288P50_4X3	23
#define CEA_VID_720X288P50_16X9	24
#define CEA_VID_2880X576I50_4X3	25
#define CEA_VID_2880X576I50_16X9	26
#define CEA_VID_2880X288P50_4X3	27
#define CEA_VID_2880X288P50_16X9	28
#define CEA_VID_1440X576P50_4X3	29
#define CEA_VID_1440X576P50_16X9	30
#define CEA_VID_1920X1080P50	31
#define CEA_VID_1920X1080P24	32
#define CEA_VID_1920X1080P25	33
#define CEA_VID_1920X1080P30	34
#define CEA_VID_2880X480P60_4X3	35
#define CEA_VID_2880X480P60_16X9	36
#define CEA_VID_2880X576P50_4X3	37
#define CEA_VID_2880X576P50_16X9	38
#define CEA_VID_1920X1080I50_1250TOTAL	39
#define CEA_VID_1280X720P100	41
#define CEA_VID_720X576P100_4X3	42
#define CEA_VID_720X576P100_16X9	43
#define CEA_VID_720X576I100_4X3	44
#define CEA_VID_720X576I100_16X9	45
#define CEA_VID_1920X1080I120	46
#define CEA_VID_1280X720P120	47
#define CEA_VID_720X480P120_4X3	48
#define CEA_VID_720X480P120_16X9	49
#define CEA_VID_720X480I120_4X3	50
#define CEA_VID_720X480I120_16X9	51
#define CEA_VID_720X576P200_4X3	52
#define CEA_VID_720X576P200_16X9	53
#define CEA_VID_720X576I200_4X3	54
#define CEA_VID_720X576I200_16X9	55
#define CEA_VID_720X480P240_4X3	56
#define CEA_VID_720X480P240_16X9	57
#define CEA_VID_720X480I240_4X3	58
#define CEA_VID_720X480I240_16X9	59
#define CEA_VID_1280X720P24	60
#define CEA_VID_1280X720P25	61
#define CEA_VID_1280X720P30	62
#define CEA_VID_1920X1080P120	63
#define CEA_VID_1920X1080P100	64
#define CEA_VID_1280X720P24_64X27	65
#define CEA_VID_1280X720P25_64X27	66
#define CEA_VID_1280X720P30_64X27	67
#define CEA_VID_1280X720P50_64X27	68
#define CEA_VID_1280X720P60_64X27	69
#define CEA_VID_1280X720P100_64X27	70
#define CEA_VID_1280X720P120_64X27	71
#define CEA_VID_1920X1080P24_64X27	72
#define CEA_VID_1920X1080P25_64X27	73
#define CEA_VID_1920X1080P30_64X27	74
#define CEA_VID_1920X1080P50_64X27	75
#define CEA_VID_1920X1080P60_64X27	76
#define CEA_VID_1920X1080P100_64X27	77
#define CEA_VID_1920X1080P120_64X27	78
#define CEA_VID_1680X720P24	79
#define CEA_VID_1680X720P25	80
#define CEA_VID_1680X720P30	81
#define CEA_VID_1680X720P50	82
#define CEA_VID_1680X720P60	83
#define CEA_VID_1680X720P100	84
#define CEA_VID_1680X720P120	85
#define CEA_VID_2560X1080P24	86
#define CEA_VID_2560X1080P25	87
#define CEA_VID_2560X1080P30	88
#define CEA_VID_2560X1080P50	89
#define CEA_VID_2560X1080P60	90
#define CEA_VID_2560X1080P100	91
#define CEA_VID_2560X1080P120	92
#define CEA_VID_3840X2160P24	93
#define CEA_VID_3840X2160P25	94
#define CEA_VID_3840X2160P30	95
#define CEA_VID_3840X2160P50	96
#define CEA_VID_3840X2160P60	97
#define CEA_VID_4096X2160P24	98
#define CEA_VID_4096X2160P25	99
#define CEA_VID_4096X2160P30	100
#define CEA_VID_4096X2160P50	101
#define CEA_VID_4096X2160P60	102
#define CEA_VID_3840X2160P24_64X27	103
#define CEA_VID_3840X2160P25_64X27	104
#define CEA_VID_3840X2160P30_64X27	105
#define CEA_VID_3840X2160P50_64X27	106
#define CEA_VID_3840X2160P60_64X27	107
//Native Video Format flag for SVD
#define NVF	(1<<7)

//CEA-861 Audio Format Code
#define CEA_AUD_LPCM	1
#define CEA_AUD_AC3	2
#define CEA_AUD_MPEG1	3
#define CEA_AUD_MP3	4
#define CEA_AUD_MPEG2	5
#define CEA_AUD_AAC	6
#define CEA_AUD_DTS	7
#define CEA_AUD_ATRAC	8
#define CEA_AUD_BIT_AUD	9
#define CEA_AUD_E_AC3	10
#define CEA_AUD_DTS_HD	11
#define CEA_AUD_MAT	12
#define CEA_AUD_DST	13
#define CEA_AUD_WMA_PRO	14

//CEA-861 Audio Sampling Frequency
#define CEA_ASF_192KHZ	(1<<6)
#define CEA_ASF_176KHZ	(1<<5)
#define CEA_ASF_96KHZ	(1<<4)
#define CEA_ASF_88KHZ	(1<<3)
#define CEA_ASF_48KHZ	(1<<2)
#define CEA_ASF_44KHZ	(1<<1)
#define CEA_ASF_32KHZ	(1<<0)

//CEA-861 LPCM Audio Bit Precision
#define CEA_LPCM_24B	(1<<2)
#define CEA_LPCM_20B	(1<<1)
#define CEA_LPCM_16B	(1<<0)

#endif	/* __EDID_TABLE_H__ */


#endif	// __USE_LT8619_RX__

